import java.util.concurrent.ExecutionException;
import java.util.concurrent.FutureTask;

public class TestFutureTask1 {
    public static void main(String[] args) throws ExecutionException, InterruptedException {
        System.out.println("主线程开始执行...");

        CallableExample callableExample = new CallableExample();
        FutureTask<Integer> integerFutureTask = new FutureTask<>(callableExample);
        // 创建线程并执行 FutureTask
        Thread thread = new Thread(integerFutureTask);
        thread.start();

        System.out.println("主线程继续干其他事...");

        Integer result = integerFutureTask.get();
        System.out.println("结果是:" + result);
    }

}
